import {developUrl,serverDK} from '@/views/api/api'
const TOKEN = localStorage.token;
import Vue from 'vue';
import axios from 'axios';

export const apiGetAreaGaishu = () => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/count',
  }).then((res) => res).catch((error) => {console.log('出错',error);});};
  

export const apiGetArealist = (param) => {
  return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/list',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};

export const apiGetAreaDetail = (param) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/detail/'+param,
  }).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiGetAreaDetailServerItem = (param) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/business/'+param,
  }).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiGetAreaDetailServerItemInfo = (param) => {
  return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/search/service',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiGetAreaSearch = (param) => {
  return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/search',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};



export const apiGetWangDuanByIdAndType = (param) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'segment/selectAll',
  }).then((res) => res).catch((error) => {console.log('出错',error);});};

export const apiInsertAreaInfo = (param) => {
  return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/save',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiUpdataAreaInfo = (param) => {
  return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/update',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};



export const apiDelArea = (param) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/'+param.id+'/del',
  }).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiChanelSearch = (param) => {
  return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'channel/search',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};





export const apiChanelDetail = (param) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'channel/detail/'+param.id,
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiInsertData = (param) => {
  return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'channel/save',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiChannelUpdata = (param) => {
  return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'channel/update',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiChanelDel = (param) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'channel/del/'+param,
  }).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiGetBaseInfo = (param) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'public/service/'+param+'/detail',
  }).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiResourceSearch = (param) => {
  return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'resource/service/log/search',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiRequestCount = (param) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'resource/service/log/'+param+'/request/count',
  }).then((res) => res).catch((error) => {console.log('出错',error);});};

export const apiServiceQuality = (param,year) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'resource/service/log/'+param+'/service/quality?year='+year,
  }).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiAreaAreaTopu = (param) => {
  return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/areaTopu',
 	 data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};



export const apihealth = (param) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'resource/service/log/'+param.id+'/service/health/day?year='+param.year+'&month='+param.month,
  }).then((res) => res).catch((error) => {console.log('出错',error);});};

export const apihealthAll = (param) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'resource/service/log/service/health/day?year='+param.year+'&month='+param.month,
  }).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiPaiMing = (param,businessTypeId) => {
  return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'resource/service/log/'+param+'/gather/rank?businessType='+businessTypeId,
  }).then((res) => res).catch((error) => {console.log('出错',error);});};





export const apiGetAreaTongdao=(param)=>{
	return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/'+param+'/channel/list',
  }).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiDaochu=(param)=>{
	return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'resource/service/log/down',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};

export const apiAreaPeizhi=(param)=>{
	return axios({method : 'post',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'area/strategy/save',
  data:param}).then((res) => res).catch((error) => {console.log('出错',error);});};

export const apiApplyTime=(id,year)=>{
	return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'resource/service/log/'+id+'/service/frequency/month?year='+year,
  }).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiRequestTotal=(id)=>{
	return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'resource/service/log/'+id+'/service/requester',
  }).then((res) => res).catch((error) => {console.log('出错',error);});};


export const apiRequestCountTime=(id,year)=>{
	return axios({method : 'get',headers : {'Content-Type' : 'application/json'},
    	url : developUrl+serverDK+'resource/service/log/'+id+'/yearRequest/count?year='+year,
  }).then((res) => res).catch((error) => {console.log('出错',error);});};



